//
// Created by WangPeng on 2024/8/15.
//

#ifndef RTSP_H264_SERVER_UDP_SK_H
#define RTSP_H264_SERVER_UDP_SK_H

#include <string>
#include <experimental/internet>


class CUdpSocket
{
public:
    /*
     * ip、port用于创建服务端的UDP socket
     */
    CUdpSocket(std::string serv_ip, int serv_port);
    /*
     * 无参的则构建client端的socket
     */
    CUdpSocket();
    ~CUdpSocket();
    void init_client_addr(std::string client_ip, int client_port);
    ssize_t send_udp_package(void* packet, std::size_t len);
private:
    std::string serv_ip_{};
    int serv_port_{};
    int udp_fd_{};
    //client ip and port
    std::string client_ip_{};
    int client_port_{};
    struct sockaddr_in addr_{};
};

#endif //RTSP_H264_SERVER_UDP_SK_H
